package com.example.ibsp_demo.pojo.entity.content;

import java.util.Date;

public class Draft {
    private Integer draftId;//
    private Integer uid;//用户id
    private String title;//草稿标题
    private String contentText;//草稿正文
    private String draftType;//草稿类型
    private String coverImage;//封面图url
    private String tagIds;//标签id集合
    private Date lastEditTime;//最后编辑时间
    private Integer isSubmit;//是否提交（1提交，2未提交）

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    private Integer pid;

    // 无参构造函数
    public Draft () {
    }

    // 有参构造函数
    public Draft (Integer draftId, Integer uid, String title, String contentText, String draftType,
                   String coverImage, String tagIds, Date lastEditTime, Integer isSubmit) {
        this.draftId = draftId;
        this.uid = uid;
        this.title = title;
        this.contentText = contentText;
        this.draftType = draftType;
        this.coverImage = coverImage;
        this.tagIds = tagIds;
        this.lastEditTime = lastEditTime;
        this.isSubmit = isSubmit;
    }

    // Getter 和 Setter 方法
    public Integer getDraftId () {
        return draftId;
    }

    public void setDraftId(Integer draftId) {
        this.draftId = draftId;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContentText() {
        return contentText;
    }

    public void setContentText(String contentText) {
        this.contentText = contentText;
    }

    public String getDraftType() {
        return draftType;
    }

    public void setDraftType(String draftType) {
        this.draftType = draftType;
    }

    public String getCoverImage() {
        return coverImage;
    }

    public void setCoverImage(String coverImage) {
        this.coverImage = coverImage;
    }

    public String getTagIds() {
        return tagIds;
    }

    public void setTagIds(String tagIds) {
        this.tagIds = tagIds;
    }

    public Date getLastEditTime() {
        return lastEditTime;
    }

    public void setLastEditTime(Date lastEditTime) {
        this.lastEditTime = lastEditTime;
    }

    public Integer getIsSubmit() {
        return isSubmit;
    }

    public void setIsSubmit(Integer isSubmit) {
        this.isSubmit = isSubmit;
    }

    //  toString 方法
    @Override
    public String toString() {
        return "TDraft{" +
                "draftId=" + draftId +
                ", uid=" + uid +
                ", title='" + (title != null ? title.substring(0, Math.min(title.length(), 50)) + "..." : "null") + '\'' +
                ", contentText='" + (contentText != null ? contentText.substring(0, Math.min(contentText.length(), 50)) + "..." : "null") + '\'' +
                ", draftType='" + draftType + '\'' +
                ", coverImage='" + coverImage + '\'' +
                ", tagIds='" + tagIds + '\'' +
                ", lastEditTime=" + lastEditTime +
                ", isSubmit=" + isSubmit +
                '}';
    }
}

